home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 151-175 / scopedisk161 / curses / examples / bio / disp_chart.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-19  |  1.1 KB  |  47 lines

  1. #include <curses.h>
  2. #include <math.h>
  3. #include "defs.h"
  4.  
  5. disp_chart (dab, stdy, styr)
  6. int     dab,stdy,styr;            /* days after birth for plot */
  7. {
  8.  
  9.     int     i, p, s, day;
  10.     int     span = 30;        /* No. of days displayed */
  11.     int     month, dt;
  12.  
  13.  
  14.     erase ();            /* Clear the screen */
  15.  
  16.     move (5, 70);
  17.     addch ('+');        /* add the plus sign */
  18.     move (10, 70);
  19.     addch ('0');        /* add the 0 for median */
  20.     move (15, 70);
  21.     addch ('-');        /* add the minus sign */
  22.     for (day = 0; day < span; day++)
  23.     {
  24.         i = 10 - (10.0 * sin ((day + dab) / 33.0 * 2.0 * PI));
  25.         p = 10 - (10.0 * sin ((day + dab) / 23.0 * 2.0 * PI));
  26.         s = 10 - (10.0 * sin ((day + dab) / 28.0 * 2.0 * PI));
  27.         move (10, day * 2);
  28.         addch ('-');
  29.         move (i, day * 2);
  30.         addch ((i == p || i == s) ? '*' : 'I');
  31.         move (p, day * 2);
  32.         addch ((p == i || p == s) ? '*' : 'P');
  33.         move (s, day * 2);
  34.         addch ((s == i || s == p) ? '*' : 'S');
  35.         dt = date (day + stdy, styr, &month);
  36.         pr_dte (dt, day * 2, month);
  37.     }
  38.     move (23, 25);
  39.     noecho ();
  40.     attrset (A_REVERSE);
  41.     printw ("PRESS ANY KEY TO CONTINUE");
  42.     attrset (0);
  43.     refresh ();
  44.     getch ();
  45.     echo ();
  46. }
  47.